package com.example.springbgootjwt.controller;

import org.springframework.stereotype.Controller;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.regex.Pattern;

@Controller
public class VerifyController {

    @RequestMapping("/verifyUser/{id}")
    public void  verifyUser(@PathVariable String id, HttpServletResponse reponse) throws IOException {

        if(StringUtils.isEmpty(id)){
            reponse.getWriter().write("参数错误，激活失败");
        }else{
            if(!Pattern.matches("^[0-9]*$",id)){
                reponse.getWriter().write("参数错误，激活失败");
            }else{
                reponse.getWriter().write("激活成功");
            }
        }


    }
}
